package com.dqyt.khjc.controller;

import com.alibaba.fastjson.JSON;
import com.dqyt.khjc.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * 登录信息控制器
 */
@RestController
public class LoginController {

    /**
     * 登录Service
     */
    @Autowired
    private LoginService loginService;

    /**
     * 用户登录请求
     *
     * @param request
     * @param id
     * @param password
     * @return
     */
    @RequestMapping("/api/login")
    public String login(HttpServletRequest request, String id, String password) {
        return JSON.toJSONString(loginService.login(request, id, password));
    }

}
